/**
 * Created by zhou on 2016/7/12.
 */


drawNoInspBar=function(data) {
    drawBarToDiv(data.result,"barBox","TYPE","NUM");
}


/**
 *
 * @param data  数据 []
 * @param id  装图形的容器
 * @param valueName 数据对应 名称 key
 * @param value 数据对应 值 key
 */
drawBarToDiv =function (data,id,valueName,value)
{
    var totale=0;
    var Axisdata=new Array();
    var showdata=new Array();
    for(var i=0;i<data.length;i++){
        Axisdata.push(data[i][valueName]);
        var num =data[i][value];
        num=num==null?"0":num;
        num=parseInt(num);
        showdata.push(num);
        totale+=num;
    }
    if(totale >0 )
    {
        //Axisdata[Axisdata.length-1]=Axisdata[Axisdata.length-1]+"(缺陷来源)"
        //console.log(Axisdata);
        //console.log(showdata);
        var picECharts = new PicEChart();
        $("#"+id).css("width", $("#"+id).width()-10)
        picECharts.addbar({name1:'降水量',Axisdata:Axisdata,data:showdata,divObject:id,color:["#8b67c9"]});
        //$("#"+box).parent().find("i").remove(); edit by zy
        $("#"+id).parent().find("i").remove();
        $(".zy-defect-text").show();
    }else{
        //$("#"+box).html("<img src='"+$("#"+box).attr("img")+"'  />");  edit by zy
        //$("#"+box).parent().append("<i></i>");  edit by zy
        $("#"+id).html("<img src='"+$("#"+id).attr("img")+"'  />");
        $("#"+id).parent().append("<i></i>");
        $(".zy-defect-text").hide();
    }

}